define(
		[ "PDUtilDir/grid", "PDUtilDir/searchBlock", "PDUtilDir/slidebar" ],
		function(Grid, SearchBlock, Slidebar) {

			function init(cache, addObj, updateObj, searchObj) {
				SearchBlock.init('searchBlockId');
				var strObj = {
					pay : '<a href="javascript:angular.element(\'#CustomerGirdDivId\').scope().paySupport.run',
					pay_suffix : '">缴费</a>',

					renew : '<a href="javascript:angular.element(\'#CustomerGirdDivId\').scope().paySupport.run',
					renew_suffix : '">续费</a>'
				}, getStr = function(oper, id) {
					return strObj[oper] + '(\'' + id + '\')'
							+ strObj[oper + '_suffix'];
				};

				// 初始化
				return Grid({
					id : "CustomerGirdDivId",
					pageSize : 10,
					index : true,
					multi : true,
					pagination : true,
					cache : false,
					layout : [
							{
								name : "部门名称",
								field : "deptName",
								sort : true,
								click : function(e) {
									updateObj.run(e.data.row);
								}
							},
							{
								name : "联系人",
								field : "personName",
								sort : true
							},
							{
								name : "联系电话",
								field : "personPhone",
								sort : true
							},
							{
								name : "费用",
								field : "cost"
							},
							{
								name : "开始时间",
								field : "startTime"
							},
							{
								name : "结束时间",
								field : "endTime"
							},
							{
								name : "类型",
								field : "serviceTypes",
								format : function(e) {
									if (!cache.serviceTypes)
										return;
									for (var i = 0; i < cache.serviceTypes.length; i++) {
										if (cache.serviceTypes[i].dictCode == e.row.serviceType) {
											return cache.serviceTypes[i].dictName;
										}
									}
								}
							},
							{
								name : "操作",
								field : "createTime",
								format : function(e) {
									var str = undefined, data = e.row, id = data.customerManageId, status = data.status;
									if (status == "D_CUSTOMER_STATUS_STOP"
											|| status == 'D_CUSTOMER_STATUS_NO_PAY'
											|| status == 'D_CUSTOMER_STATUS_NO_MONEY') {
										str = getStr('pay', id);
									} else if (status == "D_CUSTOMER_STATUS_PAY") {
										str = getStr('renew', id);
									}
									return str;
								}
							} ],
					toolbar : [ {
						name : "添加",
						icon : "fa fa-search",
						callback : function(event) {
							addObj.run();
						}
					}, {
						name : "查询",
						icon : "fa fa-search",
						callback : function(event) {
							searchObj.run();
						}
					} ],
					data : {
						type : 'URL',
						value : getServer()
								+ '/flea/hclv/customer/manage/selectAll.htmls'
					}
				});
			}
			return {
				init : init
			}
		});